49fc54
@@ -312,6 +312,9 @@
public class NamespaceUpgrade implements Tool {
             + oldMetaRegionDir + " to " + newMetaRegionDir);
       }
     }
+    // Remove .tableinfo files as they refer to ".META.".
+    // They will be recreated by master on startup.
+    removeTableInfoInPre96Format(TableName.META_TABLE_NAME);
 
     Path oldRootDir = new Path(rootDir, "-ROOT-");
     if(!fs.rename(oldRootDir, backupDir)) {
@@ -319,6 +322,21 @@
public class NamespaceUpgrade implements Tool {
     }
   }
 
+  /**
+   * Removes .tableinfo files that are laid in pre-96 format (i.e., the tableinfo files are under
+   * table directory).
+   * @param tableName
+   * @throws IOException
+   */
+  private void removeTableInfoInPre96Format(TableName tableName) throws IOException {
+    Path tableDir = FSUtils.getTableDir(rootDir, tableName);
+    FileStatus[] status = FSUtils.listStatus(fs, tableDir, TABLEINFO_PATHFILTER);
+    if (status == null) return;
+    for (FileStatus fStatus : status) {
+      FSUtils.delete(fs, fStatus.getPath(), false);
+    }
+  }
+
   public void migrateACL() throws IOException {
 
     TableName oldTableName = TableName.valueOf(OLD_ACL);
